package org.lds.scheduled.job.admin.business.worker.converter;

import org.lds.scheduled.job.admin.business.worker.entity.Worker;
import org.lds.scheduled.job.admin.business.worker.model.request.WorkerBaseGetByKeyRequest;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class WorkerBaseGetByKeyRequestToEntityConverter implements Converter<WorkerBaseGetByKeyRequest, Worker> {

    @Override
    public Worker convert(WorkerBaseGetByKeyRequest source) {
        return Worker.builder()
                .appId(source.getAppId())
                .ip(source.getIp())
                .port(source.getPort())
                .build();
    }

}